<template>
  <div class="page">
    <van-tabs v-model="active" sticky>
      <van-tab title="已完成">
        <van-panel
          :title="item.nickName"
          :desc="item.createTime"
          status="已完成"
          v-for="(item, index) in list"
          :key="index"
        >
          <goods :item="item"/>
        </van-panel>
      </van-tab>
      <van-tab title="已退款">
<!--        <van-panel-->
<!--          title="推广者:张三 绩效:82元"-->
<!--          desc="成单时间： 2019/03/23 12:12:12"-->
<!--          status="已退款"-->
<!--          v-for="(item, index) in list"-->
<!--          :key="index"-->
<!--        >-->
<!--          <goods :item="item"/>-->
<!--        </van-panel>-->
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import Goods from '@/components/Goods2.vue'
import { getMyDistributorOrders } from '@/api'

export default {
  name: 'over',
  components: {
    Goods
  },
  data() {
    return {
      active: 0,
      list:[],
      // list: [
      //   {
      //     title: '跟老王学英语跟老王学英语跟老王学英语跟老王学英语',
      //     price: 0.01,
      //     oPrice: 200.00,
      //     desc: '王小二学英语是给小孩子的英语启蒙',
      //     tag: '',
      //     img: 'https://edu-image.nosdn.127.net/d12a7de7-e810-42eb-a174-4273f6e33be9.png'
      //   },
      //   {
      //     title: '跟老王学英语',
      //     price: 0.01,
      //     oPrice: 200.00,
      //     desc: '王小二学英语是给小孩子的英语启蒙王小二学英语是给小孩子的英语启蒙',
      //     tag: '',
      //     img: 'https://edu-image.nosdn.127.net/39afa21f-cd66-4938-a084-d36a136478ab.png'
      //   }
      // ]
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      console.log(1111)
      getMyDistributorOrders().then(res => {
        for(let i=0;i<res.length;i++){
          res[i].nickName = "购买者:" + res[i].nickName + "  绩效:" + res[i].leaderPrice
          res[i].createTime = "成单时间  "+res[i].createTime
        }
        this.list = res
        console.log(this.list)
      })
    },
  }
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
@import '../style/mixin'
.van-panel
  margin-bottom $part-width
</style>
